import { createStore } from "vuex";
import type { InjectionKey } from "vue";

import type { Store } from "vuex"; 
import   { useStore as baseUseStore, } from "vuex"; 

import boardMenu from "./modules/boardMenu";
import userMessage from "./modules/userMessage";
import boardControl from "./modules/boardControl";

// 类型
import { ControlState } from "./modules/boardControl";
import { RoutersState,RouterMoel } from "./modules/boardMenu";
import { UserState } from "./modules/userMessage";



export interface State {

}
//继承主模块下的接口 (变化部分)
interface StateAll extends State{
  userMessage:UserState,      //UserState是上面引入的类型 users是自己定义的名
  boardMenu:RoutersState<RouterMoel>,
  boardControl:ControlState,
}

//这个就不可使用了 要换成下面的继承之后的接口
// export const key: InjectionKey<Store<StateAll>> = Symbol();
 
export default createStore<State>({
  modules: {
    boardMenu,
    userMessage,
    boardControl
  },
});
// // 定义自己的 `useStore` 组合式函数 这里也有了变化
//  export function useStore () {
//   const key: InjectionKey<Store<StateAll>> = Symbol()
//    return baseUseStore(key)//把key导出去了
//  }

